<template>
    <!-- <div>首页组件</div> -->
    <div class="xtx-home-page"> 
<div class="home-entry">
  <div class="contsiner">
    <!-- 左侧分类 -->
    <HomeCategory />
    <!-- 轮播图 -->
       <div class="home-banner">
          <XtxCarousel auto-play :sliders="sliders"></XtxCarousel>
        </div>
  </div>
</div>
 <!-- 新鲜好物 -->
 <HomeNew />
  <!-- 人气推荐 -->
    <HomeHot />
    <!-- 热门品牌 -->
    <HomeBrand />
    </div>
</template>
<script>
import { onMounted, ref } from "vue";
import HomeCategory from "./components/home-category.vue";
import { getBanner } from "@/api/home";
import HomeNew from "./components/home-new.vue";
import HomeHot from "./components/home-hot.vue";
import HomeBrand from "./components/home-brand.vue";
export default {
    name: 'xtx-home-page',
    components: { HomeCategory,HomeNew,HomeHot,HomeBrand  },
     setup() {
    // 1. 轮播图数据
    const sliders = ref([]);
    onMounted(async () => {
      const data = await getBanner();
      sliders.value = data.result;
    });
    // 切换数据
    const show = ref(true);
    return { sliders, show };
  },
}
</script>
<style lang="less" scoped>
.xtx-home-page {
  .home-banner {
    width: 1240px;
    height: 500px;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 98;
    // 覆盖轮播图组件样式
    .xtx-carousel {
      width: 100%;
      height: 100%;
      // 子组件看不见的内容（组件内部）
      ::v-deep {
        .carousel-btn.prev {
          left: 270px;
        }
        .carousel-indicator {
          padding-left: 250px;
        }
      }
    }
  }
}
</style>
